package com.shark.uh.enums;

public enum ResponseCode {
    // 通用返回码
    SUCCESS(200, "Success - 操作成功"),
    CREATED(201, "Created - 创建成功"),
    ACCEPTED(202, "Accepted - 请求已接受"),
    NO_CONTENT(204, "No Content - 无内容"),
    BAD_REQUEST(400, "Bad Request - 请求错误"),
    UNAUTHORIZED(401, "Unauthorized - 未授权"),
    FORBIDDEN(403, "Forbidden - 禁止访问"),
    NOT_FOUND(404, "Not Found - 未找到"),
    METHOD_NOT_ALLOWED(405, "Method Not Allowed - 方法不被允许"),
    REQUEST_TIMEOUT(408, "Request Timeout - 请求超时"),
    UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type - 不支持的媒体类型"),
    TOO_MANY_REQUESTS(429, "Too Many Requests - 请求过多"),
    INTERNAL_SERVER_ERROR(500, "Internal Server Error - 内部服务器错误"),
    SERVICE_UNAVAILABLE(503, "Service Unavailable - 服务不可用"),

    // 参数相关错误
    PARAMETER_FORMAT_ERROR(2000, "Parameter format error - 参数格式错误"),
    INVALID_PARAMETER(2001, "Invalid parameter - 无效参数"),
    MISSING_REQUIRED_PARAMETER(2002, "Missing required parameter - 缺少必要参数"),
    PARAMETER_OUT_OF_RANGE(2003, "Parameter out of range - 参数超出范围"),
    CAPTCHA_WRONG(2004, "Captcha wrong - 验证码错误"),
    CAPTCHA_EXPIRED(2005, "Captcha expired - 验证码过期"),
    PASSWORD_WRONG(2006, "Password wrong - 密码错误"),
    REPASS_WRONG(2007, "RePass wrong - 两次输入密码不一致"),

    // 数据相关返回码
    DATA_NOT_FOUND(3001, "Data not found - 数据未找到"),
    DATA_ALREADY_EXISTS(3002, "Data already exists - 数据已存在"),
    DATA_INVALID(3003, "Invalid data - 数据无效"),
    DATA_SAVE_SUCCESS(3004, "Data saved successfully - 数据保存成功"),
    DATA_DELETE_SUCCESS(3005, "Data deleted successfully - 数据删除成功"),
    DATA_UPDATE_SUCCESS(3006, "Data updated successfully - 数据更新成功"),
    DATA_UPDATE_FAIL(3006, "Data updated successfully - 数据更新失败"),

    // 用户相关返回码
    USER_NOT_FOUND(4001, "User not found - 用户未找到"),
    USER_ALREADY_EXISTS(4002, "User already exists - 用户已存在"),
    INVALID_USER_CREDENTIALS(4003, "Invalid user credentials - 用户凭证无效"),
    USER_REGISTERED(4004, "User registered successfully - 用户注册成功"),
    USER_UPDATED(4005, "User updated successfully - 用户信息更新成功"),
    USER_DELETED(4006, "User deleted successfully - 用户删除成功"),

    // 权限相关返回码
    PERMISSION_DENIED(5001, "Permission denied - 权限不足"),
    ROLE_NOT_ALLOWED(5002, "Role not allowed - 角色无权操作"),
    TOKEN_EXPIRED(5003, "Token expired - 令牌过期"),
    TOKEN_INVALID(5004, "Invalid token - 无效令牌"),
    AUTHENTICATION_SUCCESS(5005, "Authentication successful - 身份验证成功"),
    LOGOUT_SUCCESS(5006, "Logout successful - 登出成功"),
    LOGIN_FAIL_PASSWORD_WRONG(5007,"Login password wrong"),

    // 系统相关返回码
    OPERATION_COMPLETED(6001, "Operation completed successfully - 操作完成"),
    SYSTEM_BUSY(6002, "System busy - 系统繁忙"),
    CONFIGURATION_ERROR(6003, "Configuration error - 配置错误"),
    ILLEGAL_OPERATION(6004, "Illegal operation - 非法操作"),
    MAINTENANCE_MODE(6005, "System under maintenance - 系统维护中"),

    // 警告类返回码
    WARNING_DATA_LIMIT(7001, "Data limit reached - 数据量超限"),
    WARNING_DEPRECATED_API(7002, "Deprecated API used - 使用了过时的API"),
    WARNING_INCOMPLETE_DATA(7003, "Incomplete data submitted - 数据不完整"),
    WARNING_ACTION_DELAYED(7004, "Action delayed - 操作延迟"),

    // 自定义业务场景返回码
    ORDER_PLACED_SUCCESS(8001, "Order placed successfully - 订单提交成功"),
    ORDER_CANCELLED(8002, "Order cancelled successfully - 订单取消成功"),
    PAYMENT_SUCCESS(8003, "Payment processed successfully - 支付成功"),
    PAYMENT_FAILED(8004, "Payment failed - 支付失败"),
    SHIPMENT_DISPATCHED(8005, "Shipment dispatched - 发货完成"),
    SHIPMENT_DELIVERED(8006, "Shipment delivered - 订单已送达"),
    REFUND_INITIATED(8007, "Refund initiated - 退款已发起"),
    REFUND_COMPLETED(8008, "Refund completed - 退款完成");

    private final int code;    // 返回码
    private final String message; // 返回描述

    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}

